<template>
  <div class="certificate-type-buttons">
    <div 
      v-for="(button, index) in buttons" 
      :key="index"
      class="type-button"
      :class="{ active: activeType === button.type }"
      @click="selectType(button.type)"
    >
      <div class="button-content">
        <div class="button-icon">
          <i :class="button.icon"></i>
        </div>
        <div class="button-text">{{ button.label }}</div>
        <div class="button-dot" v-if="activeType === button.type"></div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'CertificateTypeButton',
  props: {
    activeType: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      buttons: [
        {
          type: 'all',
          label: '证书管理',
          icon: 'el-icon-document'
        },
        {
          type: 'issue',
          label: '颁发证书',
          icon: 'el-icon-plus'
        }
      ]
    }
  },
  methods: {
    selectType(type) {
      this.$emit('type-change', type)
    }
  }
}
</script>

<style scoped>
.certificate-type-buttons {
  display: flex;
  align-items: center;
}

.type-button {
  position: relative;
  height: 40px;
  margin-right: 10px;
  border-radius: 20px;
  background-color: #f0f0f0;
  cursor: pointer;
  transition: all 0.3s;
  padding: 0 16px;
  display: flex;
  align-items: center;
  color: #606266;
}

.type-button:hover {
  background-color: #e6f7ff;
  color: #409EFF;
}

.type-button.active {
  background-color: #409EFF;
  color: white;
}

.button-content {
  display: flex;
  align-items: center;
}

.button-icon {
  margin-right: 6px;
  font-size: 16px;
}

.button-text {
  font-size: 14px;
  font-weight: 500;
}

.button-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: white;
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
}
</style> 